#ifndef lcd_xh_H
#define lcd_xh_H

#include "stdint.h"
#include "mytype.h"
#include "lcd_yl.h"

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct
	{
		uu8 data_mask;
		uu8 *p_lcd_ram;
		uu8 half_space_en;
		uu8 update_cnt;

		const uu8 *ascii_img;

		ii8 font_size_x; 
		ii8 font_size_y; 

		ii8 font_space_x; 
		ii8 page_size;	  
		ii16 x_offset, y_offset;

		ii16 size_x;		 
		ii16 size_y;		 
		ii16 line_x, line_y; 

		const uu8 *(*gb2312_cn_get)(uu32 mem_offset, uu16 font_x);
	} lcd_xh_def_type;

	void lcd_xh_init(lcd_xh_def_type *obj, uu8 *pbuff, ii16 xsize, ii16 ysize);

	void lcd_xh_disp_buff_set(uu8 *pbuff, ii16 xsize, ii16 ysize); 
	lcd_xh_def_type *lcd_xh_obj_link(lcd_xh_def_type *lcd_xh);	   

	void lcd_xh_font_set(uu8 Fontx, uu8 Fonty, const uu8 *Ascii); 
	void lcd_xh_half_en(void);									  
	void lcd_xh_half_dis(void);									  
	void lcd_xh_anti(void);										  
	void lcd_xh_normal(void);									  
	void lcd_xh_space_set(uu8 Space);							  
	void lcd_xh_origin_set(ii16 x0, ii16 y0);					  

	void lcd_xh_put_space(ii16 x, ii16 y, ii8 Amounts);				 
	void lcd_xh_put_char(ii16 x, ii16 y, char DispCh);				 
	void lcd_xh_put_cn(ii16 x, ii16 y, const uu8 *pCN);				 
	void lcd_xh_puts(ii16 x, ii16 y, const char *DispStr);			 
	void lcd_xh_put_nums(ii16 x, ii16 y, const char *DispStr);		 
	void lcd_xh_put_cns(ii16 x, ii16 y, ii8 Amount, const uu8 *pCN); 
	void lcd_xh_dot_set(ii16 x, ii16 y);							 
	void lcd_xh_dot_clr(ii16 x, ii16 y);							 
	void lcd_xh_ram_fill(uu8 Val);									 
	void lcd_xh_line(ii16 x0, ii16 y0, ii16 x1, ii16 y1);			 
	void lcd_xh_square(ii16 x0, ii16 y0, ii16 x1, ii16 y1);			 
	void lcd_xh_square_fill(ii16 x0, ii16 y0, ii16 x1, ii16 y1);	 
	void lcd_xh_imgage_quick(ii16 x0, ii16 y0, ii16 wide, ii16 high, const uu8 *pImg);
	void lcd_xh_circle(ii16 x, ii16 y, ii16 r);
	void lcd_xh_move_to(ii16 x0, ii16 y0); 
	void lcd_xh_line_to(ii16 x1, ii16 y1); 

	void lcd_xh_alain_puts(ii16 x, ii16 y, const char *DispStr, uu16 mode);					   
	void lcd_xh_alain_put_nums(ii16 x, ii16 y, const char *DispStr, uu16 mode);				   
	void lcd_xh_alain_put_cns(ii16 x, ii16 y, ii8 Amount, const uu8 *pCN, uu16 mode);		   
	dword_tt lcd_xh_alain_xy_get(ii16 x, ii16 y, const char *DispStr, ii16 cn_num, uu16 mode); 
	void lcd_xh_alain_sq_and_line(ii16 x, ii16 y, ii16 text_wide, uu16 mode);

	void lcd_xh_alain_ext_puts(ii16 x, ii16 y, const char *str, uu16 mode);
	
	void lcd_xh_fmt(ii16 x, ii16 y, uu16 mode, const char *fmt, ...); 

	void lcd_xh_poll(uu16 x0, uu16 y0, uu8 y_amount, void (*lcd_data_write)(short y, short xoffset, uu8 const *pdat)); 
	uu8 lcd_xh_update_cnt_get(void);

#ifdef __cplusplus
}
#endif

#endif 
